const env=process.env.NODE_ENV

type redisConf = {
  port:number,
  host:string
}
type mysqlConf = {
  host:string,
  user:string,
  password:string,
  port:string,
  database:string,
}

let MYSQL_CONF!:mysqlConf
let REDIS_CONF!:redisConf
//区分线上和线下的区别
if(env === 'dev'){  
  MYSQL_CONF={
  host:"localhost",
  user:"root",
  password:"admin",
  port:"3306",
  database:"book"
  }
  REDIS_CONF = {
    port : 6379,
    host : '127.0.0.1',
  }

}
if(env === "production"){
  MYSQL_CONF={
    host:"47.93.211.228",
  user:"ttzxh",
  password:"R7YxjrGEpchhaCex",
  port:"3306",
  database:"book"
  }
  REDIS_CONF = {
    port : 6379,
    host : '127.0.0.1',
  }

}

module.exports = {MYSQL_CONF,REDIS_CONF}